<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/*hh
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of autocomplete
 * 
 * @author Subha Sundar Das (subhasundar.das@gmail.com)
 */
class Autocomplete extends CI_Controller {

    //put your code here


    function Autocomplete() {
        parent :: __construct();
        //put your code here
    }

    function keywords() {
        //print autocomplete;
        $keyword = $_GET['q'];
        if (isset($keyword) && strlen($keyword) >= 1) {
            $this->db->select('*')->like('title', $keyword);
            $this->db->limit(10);
            $query = $this->db->get('listing_master');

            foreach ($query->result() as $row) {
                echo $row->title . "\n";
            }
            //break;
        }
    }

    function city() {
        //print autocomplete;
        $city = $_GET['q'];
        if (isset($city) && strlen($city) >= 1) {
            $this->db->select('*')->like('city', $city);
            $this->db->limit(10);
            $query = $this->db->get('city');

            foreach ($query->result() as $row) {
                echo $row->city . "\n";
            }
            //break;
        }
    }
}

?>
